<?php
defined('IN_IXDCW') or exit('Access Denied');
$do = new CompanyAdmin;
$menus = array (
	array('企业列表', '?moduleid='.$moduleid.'&file=list'),
	array('待审核', '?moduleid='.$moduleid.'&file=audit'),
	array(VIP.'管理', '?moduleid='.$moduleid.'&file=vip'),
	array('会员列表', '?moduleid=2'),
);
$this_forward = '?moduleid='.$moduleid.'&file='.$file;

if($_catids || $_areaids) {
	if(isset($userid)) $itemid = $userid;
	if(isset($member['areaid'])) $post['areaid'] = $member['areaid'];
	require DT_ROOT.'/admin/admin_check.inc.php';
}

switch($action) {

	case 'delete':
		if(!$do->deleteEdition($eid,$did)) Prompt::message('删除报错,请检查是否已选择条目。','goback');
		dmsg('删除成功', $forward);
		break;

	case 'audit':
		if(!$do->auditEdition($eid,$audit)) Prompt::message('审核报错,请检查是否已选择条目。','goback');
		dmsg('审核操作成功', $forward);
		break;

	default:
		$sfields = array('按条件', '公司名');
		$dfields = array('keyword', 'title');
		$MS = PCache::read('module-2.php');
		$modes = explode('|', '经营模式|'.$MS['com_mode']);
		$types = explode('|', '公司类型|'.$MS['com_type']);
		$sizes = explode('|', '公司规模|'.$MS['com_size']);

		$thumb = isset($thumb) ? intval($thumb) : 0;
		$mincapital = isset($mincapital) ? dround($mincapital) : '';
		$mincapital or $mincapital = '';
		$maxcapital = isset($maxcapital) ? dround($maxcapital) : '';
		$maxcapital or $maxcapital = '';
		$areaid = isset($areaid) ? intval($areaid) : 0;
		isset($mode) && isset($modes[$mode]) or $mode = 0;
		isset($type) && isset($types[$type]) or $type = 0;
		isset($size) && isset($sizes[$size]) or $size = 0;


		$fields_select  = dselect($sfields, 'fields', '', $fields);
		$type_select    = dselect($types, 'type', '', $type);
		$size_select    = dselect($sizes, 'size', '', $size);

		if($_areaids)   $condition .= " AND areaid IN (".$_areaids.")";//CITY
		if($catid)      $condition .= " AND category LIKE '%,".$catid.",%'";
		if($areaid)     $condition .= ($ARE['child']) ? " AND company_areaid IN (".$ARE['arrchildid'].")" : " AND company_areaid=$areaid";
		if($type)       $condition .= " AND company_type=$type";
		if($size)       $condition .= " AND company_size='$size'";
		if($thumb)      $condition .= " AND company_thumb<>''";
		if($uid)        $condition .= " AND authorid=$uid";
		if($username)   $condition .= " AND author='$username'";
		if($fromtime)   $condition .= " AND time>".(strtotime($fromtime.' 00:00:00'));
		if($totime)     $condition .= " AND time<".(strtotime($totime.' 23:59:59'));

		$lists = $do->getAuditList($condition);
		include tpl('audit', $module);
		break;
}
?>